#include "ExternalInterruptHardware.h"


void ExternalInterruptHardware::setInterruptSenseControl1(unsigned char flag)
{
	switch(flag)
	{
		case INT1_LowLeveInterrupt:
			MCUCR = SetBit(MCUCR, ISC10, 0);
			MCUCR = SetBit(MCUCR, ISC11, 0);
			break;
		case INT1_LogicChangeInterrupt:
			MCUCR = SetBit(MCUCR, ISC10, 1);
			MCUCR = SetBit(MCUCR, ISC11, 0);
			break;
		case INT1_FallingEdgeInterrupt:
			MCUCR = SetBit(MCUCR, ISC10, 0);
			MCUCR = SetBit(MCUCR, ISC11, 1);
			break;
		case INT1_RisingEdgeInterrupt:
			MCUCR = SetBit(MCUCR, ISC10, 1);
			MCUCR = SetBit(MCUCR, ISC11, 1);
			break;
		default:
			MCUCR = SetBit(MCUCR, ISC10, 0);
			MCUCR = SetBit(MCUCR, ISC11, 0);
			break;
	}
}



void ExternalInterruptHardware::setInterruptSenseControl0(unsigned char flag)
{
	switch(flag)
	{
		case INT0_LowLeveInterrupt:
			MCUCR = SetBit(MCUCR, ISC00, 0);
			MCUCR = SetBit(MCUCR, ISC01, 0);
			break;
		case INT0_LogicChangeInterrupt:
			MCUCR = SetBit(MCUCR, ISC00, 1);
			MCUCR = SetBit(MCUCR, ISC01, 0);
			break;
		case INT0_FallingEdgeInterrupt:
			MCUCR = SetBit(MCUCR, ISC00, 0);
			MCUCR = SetBit(MCUCR, ISC01, 1);
			break;
		case INT0_RisingEdgeInterrupt:
			MCUCR = SetBit(MCUCR, ISC00, 1);
			MCUCR = SetBit(MCUCR, ISC01, 1);
			break;
		default:
			MCUCR = SetBit(MCUCR, ISC00, 0);
			MCUCR = SetBit(MCUCR, ISC01, 0);
			break;
	}
}

void ExternalInterruptHardware::setInterruptSenseControl2(unsigned char flag)
{
	MCUCSR = SetBit(MCUCSR, ISC2, flag);
}

void ExternalInterruptHardware::setEnableInterruptRequest1(unsigned char flag)
{
	GICR = SetBit(GICR, INT1, flag);
}

void ExternalInterruptHardware::setEnableInterruptRequest0(unsigned char flag)
{
	GICR = SetBit(GICR, INT0, flag);
}

void ExternalInterruptHardware::setEnableInterruptRequest2(unsigned char flag)
{
	GICR = SetBit(GICR, INT2, flag);
}


